package com.ymatou.iapi.godmch.service;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.google.gson.Gson;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*代理价按条件自动加价配置列表Call
*FreeMaker Template自动生成代码
*/
public class getAgentConditionMarkupConfigListCall extends YmatouBaseCall{
	private static String opurl ="api/agent/getAgentConditionMarkupConfigList";
	
	public getAgentConditionMarkupConfigListCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	
	public String getStatusCode1()
	{
	  return getString("status");
	}
	
	 public String getMessage()
	{
	 return getString("msg");
	}
	 
		 
		public JSONArray getList()
		{
			Gson gson=new Gson();
			//return gson.fromJson(getString("result"), new TypeToken<JSONObject>() { }.getType());
			JSONArray jsonArray = JSONArray.fromObject(JSONObject.fromObject(getString("result")).get("list"));
			 return jsonArray;
		}
		
		 
		public Integer getTotal()
		{
			Gson gson=new Gson();
			Integer total = JSONObject.fromObject(getString("result")).getInt("total");
			 return total;
		}
}